{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from requests_html import HTMLSession"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "url = \"https://www.liepin.com/zhaopin/\"\n",
    "session = HTMLSession()\n",
    "r = session.get( url )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[<Element 'a' href='/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1'>, <Element 'a' href='/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=2'>, <Element 'a' href='/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=3'>, <Element 'a' href='/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=4'>, <Element 'a' href='/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1'>, <Element 'a' class=('last',) href='/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=9' title='末页'>]\n"
     ]
    }
   ],
   "source": [
    "# A-1  xpath 解析翻页a/@href\n",
    "xpath_翻页a = '//div[@class=\"pagerbar\"]/a' # 有disabled, current等href是javascript\n",
    "xpath_翻页a = '//div[@class=\"pagerbar\"]/a[starts-with(@href,\"/zhaopin\")]'\n",
    "#start-with 模糊属性\n",
    "\n",
    "print (r.html.xpath(xpath_翻页a))\n",
    "# 打印出pagerbar中的所有元素"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1', '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=2', '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=3', '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=4', '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1', '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=9']\n"
     ]
    }
   ],
   "source": [
    "# 从xpath_翻页a提取出所有的href\n",
    "\n",
    "href_列表 = [x.xpath('//@href')[0] for x in r.html.xpath(xpath_翻页a)]\n",
    "print (href_列表)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['2', '3', '4', '5', '下一页', '']\n"
     ]
    }
   ],
   "source": [
    "# 提取出里面的文字信息\n",
    "文字_列表 = [x.text for x in r.html.xpath(xpath_翻页a)]\n",
    "print (文字_列表)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'2': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1', '3': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=2', '4': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=3', '5': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=4', '下一页': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1', '': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=9'}\n"
     ]
    }
   ],
   "source": [
    "# 将文字信息作为键，将链接作为值，构建成字典\n",
    "href_字典 = {x.text:x.xpath('//@href')[0] for x in r.html.xpath(xpath_翻页a)}\n",
    "print (href_字典)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'df:'"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>scheme</th>\n",
       "      <th>netloc</th>\n",
       "      <th>path</th>\n",
       "      <th>params</th>\n",
       "      <th>query</th>\n",
       "      <th>fragment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>/zhaopin/</td>\n",
       "      <td></td>\n",
       "      <td>init=-1&amp;headckid=dd87f0752f9e5ca9&amp;fromSearchBt...</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>/zhaopin/</td>\n",
       "      <td></td>\n",
       "      <td>init=-1&amp;headckid=dd87f0752f9e5ca9&amp;fromSearchBt...</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>/zhaopin/</td>\n",
       "      <td></td>\n",
       "      <td>init=-1&amp;headckid=dd87f0752f9e5ca9&amp;fromSearchBt...</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>/zhaopin/</td>\n",
       "      <td></td>\n",
       "      <td>init=-1&amp;headckid=dd87f0752f9e5ca9&amp;fromSearchBt...</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>/zhaopin/</td>\n",
       "      <td></td>\n",
       "      <td>init=-1&amp;headckid=dd87f0752f9e5ca9&amp;fromSearchBt...</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>/zhaopin/</td>\n",
       "      <td></td>\n",
       "      <td>init=-1&amp;headckid=dd87f0752f9e5ca9&amp;fromSearchBt...</td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  scheme netloc       path params  \\\n",
       "0                /zhaopin/          \n",
       "1                /zhaopin/          \n",
       "2                /zhaopin/          \n",
       "3                /zhaopin/          \n",
       "4                /zhaopin/          \n",
       "5                /zhaopin/          \n",
       "\n",
       "                                               query fragment  \n",
       "0  init=-1&headckid=dd87f0752f9e5ca9&fromSearchBt...           \n",
       "1  init=-1&headckid=dd87f0752f9e5ca9&fromSearchBt...           \n",
       "2  init=-1&headckid=dd87f0752f9e5ca9&fromSearchBt...           \n",
       "3  init=-1&headckid=dd87f0752f9e5ca9&fromSearchBt...           \n",
       "4  init=-1&headckid=dd87f0752f9e5ca9&fromSearchBt...           \n",
       "5  init=-1&headckid=dd87f0752f9e5ca9&fromSearchBt...           "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "找出df里面不同的: scheme      1\n",
      "netloc      1\n",
      "path        1\n",
      "params      1\n",
      "query       5\n",
      "fragment    1\n",
      "dtype: int64\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'df_qs:'"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>init</th>\n",
       "      <th>headckid</th>\n",
       "      <th>fromSearchBtn</th>\n",
       "      <th>keyword</th>\n",
       "      <th>ckid</th>\n",
       "      <th>siTag</th>\n",
       "      <th>d_sfrom</th>\n",
       "      <th>d_ckId</th>\n",
       "      <th>d_curPage</th>\n",
       "      <th>d_pageSize</th>\n",
       "      <th>d_headId</th>\n",
       "      <th>curPage</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-1</td>\n",
       "      <td>dd87f0752f9e5ca9</td>\n",
       "      <td>2</td>\n",
       "      <td>UI</td>\n",
       "      <td>dd87f0752f9e5ca9°radeFlag=0</td>\n",
       "      <td>1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw</td>\n",
       "      <td>search_unknown</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>0</td>\n",
       "      <td>40</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1</td>\n",
       "      <td>dd87f0752f9e5ca9</td>\n",
       "      <td>2</td>\n",
       "      <td>UI</td>\n",
       "      <td>dd87f0752f9e5ca9°radeFlag=0</td>\n",
       "      <td>1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw</td>\n",
       "      <td>search_unknown</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>0</td>\n",
       "      <td>40</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1</td>\n",
       "      <td>dd87f0752f9e5ca9</td>\n",
       "      <td>2</td>\n",
       "      <td>UI</td>\n",
       "      <td>dd87f0752f9e5ca9°radeFlag=0</td>\n",
       "      <td>1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw</td>\n",
       "      <td>search_unknown</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>0</td>\n",
       "      <td>40</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-1</td>\n",
       "      <td>dd87f0752f9e5ca9</td>\n",
       "      <td>2</td>\n",
       "      <td>UI</td>\n",
       "      <td>dd87f0752f9e5ca9°radeFlag=0</td>\n",
       "      <td>1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw</td>\n",
       "      <td>search_unknown</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>0</td>\n",
       "      <td>40</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-1</td>\n",
       "      <td>dd87f0752f9e5ca9</td>\n",
       "      <td>2</td>\n",
       "      <td>UI</td>\n",
       "      <td>dd87f0752f9e5ca9°radeFlag=0</td>\n",
       "      <td>1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw</td>\n",
       "      <td>search_unknown</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>0</td>\n",
       "      <td>40</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-1</td>\n",
       "      <td>dd87f0752f9e5ca9</td>\n",
       "      <td>2</td>\n",
       "      <td>UI</td>\n",
       "      <td>dd87f0752f9e5ca9°radeFlag=0</td>\n",
       "      <td>1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw</td>\n",
       "      <td>search_unknown</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>0</td>\n",
       "      <td>40</td>\n",
       "      <td>b8d908888bfa411df4c3d014996e269d</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  init          headckid fromSearchBtn keyword                         ckid  \\\n",
       "0   -1  dd87f0752f9e5ca9             2      UI  dd87f0752f9e5ca9°radeFlag=0   \n",
       "1   -1  dd87f0752f9e5ca9             2      UI  dd87f0752f9e5ca9°radeFlag=0   \n",
       "2   -1  dd87f0752f9e5ca9             2      UI  dd87f0752f9e5ca9°radeFlag=0   \n",
       "3   -1  dd87f0752f9e5ca9             2      UI  dd87f0752f9e5ca9°radeFlag=0   \n",
       "4   -1  dd87f0752f9e5ca9             2      UI  dd87f0752f9e5ca9°radeFlag=0   \n",
       "5   -1  dd87f0752f9e5ca9             2      UI  dd87f0752f9e5ca9°radeFlag=0   \n",
       "\n",
       "                                           siTag         d_sfrom  \\\n",
       "0  1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw  search_unknown   \n",
       "1  1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw  search_unknown   \n",
       "2  1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw  search_unknown   \n",
       "3  1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw  search_unknown   \n",
       "4  1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw  search_unknown   \n",
       "5  1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw  search_unknown   \n",
       "\n",
       "                             d_ckId d_curPage d_pageSize  \\\n",
       "0  b8d908888bfa411df4c3d014996e269d         0         40   \n",
       "1  b8d908888bfa411df4c3d014996e269d         0         40   \n",
       "2  b8d908888bfa411df4c3d014996e269d         0         40   \n",
       "3  b8d908888bfa411df4c3d014996e269d         0         40   \n",
       "4  b8d908888bfa411df4c3d014996e269d         0         40   \n",
       "5  b8d908888bfa411df4c3d014996e269d         0         40   \n",
       "\n",
       "                           d_headId curPage  \n",
       "0  b8d908888bfa411df4c3d014996e269d       1  \n",
       "1  b8d908888bfa411df4c3d014996e269d       2  \n",
       "2  b8d908888bfa411df4c3d014996e269d       3  \n",
       "3  b8d908888bfa411df4c3d014996e269d       4  \n",
       "4  b8d908888bfa411df4c3d014996e269d       1  \n",
       "5  b8d908888bfa411df4c3d014996e269d       9  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "找出df_qs里面不同的: init             1\n",
      "headckid         1\n",
      "fromSearchBtn    1\n",
      "keyword          1\n",
      "ckid             1\n",
      "siTag            1\n",
      "d_sfrom          1\n",
      "d_ckId           1\n",
      "d_curPage        1\n",
      "d_pageSize       1\n",
      "d_headId         1\n",
      "curPage          5\n",
      "dtype: int64\n"
     ]
    }
   ],
   "source": [
    "# A-2 建构参数模板：找到关键参数及参数结构\n",
    "\n",
    "# 需要模组库\n",
    "from urllib.parse import urlparse, parse_qs\n",
    "import pandas as pd\n",
    "from IPython.display import display, HTML\n",
    "\n",
    "# 总体目标：输入 href_列表, 建构出参数字典\n",
    "\n",
    "# urlparse 解析后丢入数据框\n",
    "df = pd.DataFrame([ urlparse(x) for x in href_列表])\n",
    "# 将href_列表中的网页的链接进行urlparse拆分\n",
    "\n",
    "df_qs = pd.DataFrame([{k:v[0] for k,v in parse_qs(x).items()} for x in df['query'] ])\n",
    "# 将query中的部分再一次通过parse_qs()进行拆分\n",
    "\n",
    "display('df:',df)\n",
    "print('找出df里面不同的:',df.nunique())\n",
    "display('df_qs:',df_qs)\n",
    "print('找出df_qs里面不同的:',df_qs.nunique())\n",
    "\n",
    "df_qs.curPage\n",
    "df_qs = df_qs.assign (curPage_int=df_qs.curPage.astype(int)) # 变成整数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "参数模板: {'init': ['-1'], 'headckid': ['dd87f0752f9e5ca9'], 'fromSearchBtn': ['2'], 'keyword': ['UI'], 'ckid': ['dd87f0752f9e5ca9°radeFlag=0'], 'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'], 'd_sfrom': ['search_unknown'], 'd_ckId': ['b8d908888bfa411df4c3d014996e269d'], 'd_curPage': ['0'], 'd_pageSize': ['40'], 'd_headId': ['b8d908888bfa411df4c3d014996e269d'], 'curPage': ['1']}\n",
      "href_字典: {'2': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1', '3': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=2', '4': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=3', '5': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=4', '下一页': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1', '': '/zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=9'}\n"
     ]
    }
   ],
   "source": [
    "# A-2 建构参数模板：找到关键参数及参数结构\n",
    "def parse_url_qs_for_curPage (url):\n",
    "    six_parts = urlparse(url) \n",
    "    out = parse_qs(six_parts.query)\n",
    "    return (out)\n",
    "\n",
    "# 取第一个链接做尝试\n",
    "参数模板 = parse_url_qs_for_curPage(href_列表[0])\n",
    "print ('参数模板:',参数模板)\n",
    "\n",
    "print ('href_字典:',href_字典)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "参数模板:\n",
      "{'init': ['-1'], 'headckid': ['dd87f0752f9e5ca9'], 'fromSearchBtn': ['2'], 'keyword': ['UI'], 'ckid': ['dd87f0752f9e5ca9°radeFlag=0'], 'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'], 'd_sfrom': ['search_unknown'], 'd_ckId': ['b8d908888bfa411df4c3d014996e269d'], 'd_curPage': ['0'], 'd_pageSize': ['40'], 'd_headId': ['b8d908888bfa411df4c3d014996e269d'], 'curPage': ['1']}\n"
     ]
    }
   ],
   "source": [
    "print('参数模板:')\n",
    "print(参数模板)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "9\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{0: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [0]},\n",
       " 1: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [1]},\n",
       " 2: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [2]},\n",
       " 3: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [3]},\n",
       " 4: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [4]},\n",
       " 5: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [5]},\n",
       " 6: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [6]},\n",
       " 7: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [7]},\n",
       " 8: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [8]},\n",
       " 9: {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': [9]}}"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A-3 建构参数模板生成器：keyword curPage\n",
    "def 参数模板生成(keyword, curPage):\n",
    "    参数 = 参数模板.copy()\n",
    "    参数['curPage'] = curPage\n",
    "    参数['keyword'] = keyword\n",
    "    return (参数)\n",
    "\n",
    "参数_keyword_用户体验_curPage = { \n",
    "    i:参数模板生成(curPage = [i], \\\n",
    "                  keyword = ['用户体验']) \\\n",
    "    for i,v in href_字典.items()\\\n",
    "    }\n",
    "\n",
    "# print(参数_keyword_用户体验_curPage) # 只生成本页有的额外翻页URL, 并没有推估到&curPage=9,也没有这页\n",
    "\n",
    "print (df_qs.curPage_int.min()) # 最小值只有1\n",
    "print (df_qs.curPage_int.max()) # 最大值只有9\n",
    "\n",
    "# 应该是 0 (本页)....9(最大值)\n",
    "\n",
    "参数_keyword_用户体验_curPage = { \n",
    "    i:参数模板生成(curPage = [i], \\\n",
    "                  keyword = ['用户体验']) \\\n",
    "    for i in range(0,df_qs.curPage_int.max()+1)\\\n",
    "    }\n",
    "参数_keyword_用户体验_curPage"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'2': {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': ['2']},\n",
       " '3': {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': ['3']},\n",
       " '4': {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': ['4']},\n",
       " '5': {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': ['5']},\n",
       " '下一页': {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': ['下一页']},\n",
       " '': {'init': ['-1'],\n",
       "  'headckid': ['dd87f0752f9e5ca9'],\n",
       "  'fromSearchBtn': ['2'],\n",
       "  'keyword': ['用户体验'],\n",
       "  'ckid': ['dd87f0752f9e5ca9°radeFlag=0'],\n",
       "  'siTag': ['1B2M2Y8AsgTpgAmY7PhCfg~fA9rXquZc5IkJpXC-Ycixw'],\n",
       "  'd_sfrom': ['search_unknown'],\n",
       "  'd_ckId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'd_curPage': ['0'],\n",
       "  'd_pageSize': ['40'],\n",
       "  'd_headId': ['b8d908888bfa411df4c3d014996e269d'],\n",
       "  'curPage': ['']}}"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "参数_keyword_用户体验_curPage={i:参数模板生成(curPage=[i],keyword=['用户体验']) for i,v in href_字典.items()}\n",
    "参数_keyword_用户体验_curPage"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2 /zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1\n",
      "3 /zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=2\n",
      "4 /zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=3\n",
      "5 /zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=4\n",
      "下一页 /zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=1\n",
      " /zhaopin/?init=-1&headckid=dd87f0752f9e5ca9&fromSearchBtn=2&keyword=UI&ckid=dd87f0752f9e5ca9°radeFlag=0&siTag=1B2M2Y8AsgTpgAmY7PhCfg%7EfA9rXquZc5IkJpXC-Ycixw&d_sfrom=search_unknown&d_ckId=b8d908888bfa411df4c3d014996e269d&d_curPage=0&d_pageSize=40&d_headId=b8d908888bfa411df4c3d014996e269d&curPage=9\n"
     ]
    }
   ],
   "source": [
    "# 打印出 href_字典.items() 中的键值\n",
    "for i,v in href_字典.items():\n",
    "    print(i,v)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['1']\n",
      "['UI']\n"
     ]
    }
   ],
   "source": [
    "参数 = 参数模板.copy()\n",
    "print(参数['curPage'])\n",
    "print(参数['keyword'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_all.to_excel(\"用户体验.xlsx\",sheet_name=\"用户体验\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
